<?php  global $current_user; get_currentuserinfo(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta name="" content="" />
<title><?php elegant_titles(); ?></title>
<?php elegant_description(); ?>
<?php elegant_keywords(); ?>
<?php elegant_canonical(); ?>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/colorpicker.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/about_ez.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/page_03.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/tab_phanquyen.css" type="text/css" media="screen" />
<!--CSS -->
<link href="<?php bloginfo('template_directory'); ?>/css/style_blue.css" rel="stylesheet" type="text/css" />
<link  href="<?php bloginfo('template_directory'); ?>/css/colorbox.css" rel="stylesheet" type="text/css" />
<link  href="<?php bloginfo('template_directory'); ?>/css/tab_css.css" rel="stylesheet" type="text/css" />
<link  href="<?php bloginfo('template_directory'); ?>/css/jquery-ui_tab.css" rel="stylesheet" type="text/css" />
<!-- Dialogue -->
<link  href="<?php bloginfo('template_directory'); ?>/css/dialogue_user.css" rel="stylesheet" type="text/css" />
<link  href="<?php bloginfo('template_directory'); ?>/css/user_ql.css" rel="stylesheet" type="text/css" />
<link  href="<?php bloginfo('template_directory'); ?>/css/user_jqueryui.css" rel="stylesheet" type="text/css" />
<link  href="<?php bloginfo('template_directory'); ?>/css/upload_image.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="<?php bloginfo('template_url'); ?>/images/favicon.ico" />
<link rel="ico" type="image/ico" href="<?php bloginfo('template_url'); ?>/images/favicon.ico" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php if(is_page('upload_image_jquery')){
       // echo 'trang them san pham dó ban con';
  ?>
        <!-- Bootstrap styles -->
        <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
        <!-- Generic page styles -->
        <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/style.css">
        <!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
        <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/jquery.fileupload.css">  
<?php
}?>

<?php 
 if (is_page('upload_ttnangluongnano')) 
 {
  ?>
   <link href="<?php bloginfo('template_directory'); ?>/assets/css/style.css" rel="stylesheet" />

<?php
 }
?>

<?php
 if (is_page('ckeditor_upload')){
  ?>
 <link href="<?php bloginfo('template_directory'); ?>/ckeditor/sample.css" rel="stylesheet" /> 
  <link href="<?php bloginfo('template_directory'); ?>/ckeditor/sample.js" rel="stylesheet" />
  <link href="<?php bloginfo('template_directory'); ?>/ckeditor/ckeditor.js" rel="stylesheet" />
  <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/ckfinder/ckfinder.js"></script>
  <style type="text/css">
  img {
    padding:10px;
    margin:5px;
    border:1px solid #d5d5d5;
  }
  div.thumb {
    float:left;
  }
  div.caption {
    padding-left:5px;
    font-size:10px;
  }
  </style>
  <script type="text/javascript">

function BrowseServer( startupPath, functionData )
{
  // You can use the "CKFinder" class to render CKFinder in a page:
  var finder = new CKFinder();

  // The path for the installation of CKFinder (default = "/ckfinder/").
  finder.basePath = '../';

  //Startup path in a form: "Type:/path/to/directory/"
  finder.startupPath = startupPath;

  // Name of a function which is called when a file is selected in CKFinder.
  finder.selectActionFunction = SetFileField;

  // Additional data to be passed to the selectActionFunction in a second argument.
  // We'll use this feature to pass the Id of a field that will be updated.
  finder.selectActionData = functionData;

  // Name of a function which is called when a thumbnail is selected in CKFinder.
  finder.selectThumbnailActionFunction = ShowThumbnails;

  // Launch CKFinder
  finder.popup();
}


function SetFileField( fileUrl, data )
    {
      document.getElementById( data["selectActionData"] ).value = fileUrl;
    }

    // This is a sample function which is called when a thumbnail is selected in CKFinder.
    function ShowThumbnails( fileUrl, data )
    {
      // this = CKFinderAPI
      var sFileName = this.getSelectedFile().name;
      document.getElementById( 'thumbnails' ).innerHTML +=
          '<div class="thumb">' +
            '<img src="' + fileUrl + '" />' +
            '<div class="caption">' +
              '<a href="' + data["fileUrl"] + '" target="_blank">' + sFileName + '</a> (' + data["fileSize"] + 'KB)' +
            '</div>' +
          '</div>';

      document.getElementById( 'preview' ).style.display = "";
      // It is not required to return any value.
      // When false is returned, CKFinder will not close automatically.
      return false;
    }
  </script>

  
<?php
 }  // if (is_page('ckeditor_upload'))
 ?>

 <?php
 if (is_page('edit-product')){
  ?>
 <link href="<?php bloginfo('template_directory'); ?>/ckeditor/sample.css" rel="stylesheet" /> 
  <link href="<?php bloginfo('template_directory'); ?>/ckeditor/sample.js" rel="stylesheet" />
  <link href="<?php bloginfo('template_directory'); ?>/ckeditor/ckeditor.js" rel="stylesheet" />
  <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/ckfinder/ckfinder.js"></script>
  <style type="text/css">
  img {
    padding:10px;
    margin:5px;
    border:1px solid #d5d5d5;
  }
  div.thumb {
    float:left;
  }
  div.caption {
    padding-left:5px;
    font-size:10px;
  }
  </style>
  <script type="text/javascript">

function BrowseServer( startupPath, functionData )
{
  // You can use the "CKFinder" class to render CKFinder in a page:
  var finder = new CKFinder();

  // The path for the installation of CKFinder (default = "/ckfinder/").
  finder.basePath = '../';

  //Startup path in a form: "Type:/path/to/directory/"
  finder.startupPath = startupPath;

  // Name of a function which is called when a file is selected in CKFinder.
  finder.selectActionFunction = SetFileField;

  // Additional data to be passed to the selectActionFunction in a second argument.
  // We'll use this feature to pass the Id of a field that will be updated.
  finder.selectActionData = functionData;

  // Name of a function which is called when a thumbnail is selected in CKFinder.
  finder.selectThumbnailActionFunction = ShowThumbnails;

  // Launch CKFinder
  finder.popup();
}


function SetFileField( fileUrl, data )
    {
      document.getElementById( data["selectActionData"] ).value = fileUrl;
    }

    // This is a sample function which is called when a thumbnail is selected in CKFinder.
    function ShowThumbnails( fileUrl, data )
    {
      // this = CKFinderAPI
      var sFileName = this.getSelectedFile().name;
      document.getElementById( 'thumbnails' ).innerHTML +=
          '<div class="thumb">' +
            '<img src="' + fileUrl + '" />' +
            '<div class="caption">' +
              '<a href="' + data["fileUrl"] + '" target="_blank">' + sFileName + '</a> (' + data["fileSize"] + 'KB)' +
            '</div>' +
          '</div>';

      document.getElementById( 'preview' ).style.display = "";
      // It is not required to return any value.
      // When false is returned, CKFinder will not close automatically.
      return false;
    }
  </script>

  
<?php
 }  // if (is_page('edit-product')){
 ?>
<!-- <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />-->

<!--[if lt IE 7]>
	<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/ie6style.css" />
	<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/DD_belatedPNG_0.0.8a-min.js"></script>
	<script type="text/javascript">DD_belatedPNG.fix('img#logo, span.overlay, a.zoom-icon, a.more-icon, #menu, #menu-right, #menu-content, ul#top-menu ul, #menu-bar, .footer-widget ul li, span.post-overlay, #content-area, .avatar-overlay, .comment-arrow, .testimonials-item-bottom, #quote, #bottom-shadow, #quote .container');</script>
<![endif]-->
<!--[if IE 7]>
	<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/ie7style.css" />
<![endif]-->
<!--[if IE 8]>
	<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/css/ie8style.css" />
<![endif]-->

  
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>




  
<?php wp_head(); ?>

</head>

<body <?php body_class(); ?>>
	<?php //do_action('et_header_top'); // controller?>



  <!--wrapper -->
<div id="outer_wrapper">

 <div id="wrapper_nano">
 
    <!--header -->
    <div id="header_nano"> 
    
      <a href="<?php bloginfo('url'); ?>">
        <?php $logo = (get_option('chameleon_logo') <> '') ? get_option('chameleon_logo') : get_bloginfo('template_directory').'/images/logo.png'; ?>
        <img src="<?php echo esc_url($logo); ?>" alt="" id="logo"/>
      </a>

      <p id="slogan"><?php bloginfo('description'); ?></p>
      <?php //do_action('et_header'); // controller?>  

      
      <div id="right_header">
      <?php  //if ( current_user_can('moderate_comments') ) {echo '<p> Bạn Có thể đặt lịch</p>'; } ?>
        <div id="top_nav">
          <ul>
            <!--
            <li><a href="<?php bloginfo('url'); ?>/lien-he"><span>Liên Hệ</span></a></li>
            <li><a href="<?php bloginfo('url'); ?>/tuyen-dung"><span>Tuyên Dụng</span></a></li>
             -->
            <?php
              if (is_user_logged_in()) { ?>
             
              <li><span id='admindangnhap'><?php global $current_user;get_currentuserinfo();echo $current_user->user_login;?></span></li>

              <li><a href="<?php echo wp_logout_url( home_url() ); ?>" title="Logout">Logout</a></li>
              <?php 
              //$redirect = 'index.php'; wp_redirect($redirect); exit; 
              /*
               function wp_logout() {
               wp_clear_auth_cookie();
               do_action('wp_logout');}
               $referrer = $_SERVER['HTTP_REFERER']; //sleep (4); header ("Location: $referrer");
              */
              
              ?>

              <?php } else {?>
                <li><a href="<?php bloginfo('url'); ?>/wp-login.php" class="active"><span>Đăng Nhập</span></a></li>
                <?php }?>
          </ul>
        </div><!-- id="top_nav" -->
        
        <div id="search_header">
          <ul>
            <li>
              <form method="get" id="searchform" action="<?php echo home_url(); ?>/">
               <input type="text" value="<?php esc_attr_e('Tìm kiếm...', 'Chameleon'); ?>" name="s" id="searchinput"  onfocus="if(this.value == 'Tìm kiếm...') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Tìm kiếm...'; }" />
               <input type="image" src="<?php bloginfo('template_directory'); ?>/images/search_btn.png" id="searchsubmit" />
          </form>
              
            </li>
           
          </ul>
        </div><!-- id="search_header" -->

        
      </div><!-- id="right_header" -->
      
    </div><!-- id="header_nano" -->



    <!--Menu Area -->
  <div id="nav_nano">
      <?php $menuClass = '';
      $menuID = '';
      $primaryNav = '';
      if (function_exists('wp_nav_menu')) {
        $primaryNav = wp_nav_menu( array( 'theme_location' => 'primary-menu', 'container' => '', 'fallback_cb' => '', 'menu_class' => $menuClass, 'menu_id' => $menuID, 'echo' => false ) );
      };

     // var_dump(function_exists('wp_nav_menu'));
     // var_dump($primaryNav);

      if ($primaryNav == '') 
        { ?>
        <ul id="<?php echo esc_attr($menuID); ?>" class="<?php echo esc_attr($menuClass); ?>">

          <?php if (get_option('chameleon_home_link') == 'on') { ?>
            <li <?php if (is_home()) echo('class="current_page_item"') ?>>
              <a href="<?php bloginfo('url'); ?>">
                <?php esc_html_e('Trang chủ','Chameleon') ?>
              </a>
            </li>
          <?php }; ?>
          <?php show_categories_menu($menuClass,false); // view catalogue ?>
          <?php show_page_menu($menuClass,false,false); ?>
          

          <?php
            if ( is_user_logged_in() ) 
              {
                  //echo 'Welcome, registered user!';
                
             ?>
                  <li> <a href="<?php bloginfo('url');?>/dat-lich">
                        Đặt lịch 
                      </a>
                  </li>

                  <?php 
                  //echo $current_user->user_login;
                 // var_dump($current_user);
                  if (($current_user->allcaps['level_7'] == true) ) 
                  { 
                  ?>
                  <li> <a href="<?php bloginfo('url');?>/quan-li-may">
                        Quản lí máy
                      </a>
                      
                  </li>
           <?php  } // end if la quan li ?>

                  <?php 
                    if (  ($current_user->allcaps['level_10'] == true) )
                    {  // echo 'quyen cao nhat admintrator';
                      ?>
                           <li> 
                               <a href="<?php bloginfo('url');?>/quan-li-nguoi-dung">
                                Quản lí người dùng
                              </a>
                            <ul>
                            <li><a href="<?php bloginfo('url');?>/them-nguoi-dung">Thêm người dùng</a></li>
                            <li><a href="<?php bloginfo('url');?>/edit-user">sửa người dùng</a></li>
                            </ul>
                          </li>
                      <?php
                    }// if ($current_user->allcaps['level_10'] == true) 
                    ?>
             <?php
              }//if ( is_user_logged_in() )
               else {
                  //echo 'Welcome, visitor!';
                     }
              ?>
          
          
        </ul> <!-- end ul#nav -->

      <?php }
      else {
        echo($primaryNav); 
        ?>
          <?php

            if ( is_user_logged_in() ) 
              {
                  //echo 'Welcome, registered user!';
                
             ?>
             <ul>
                  <li> <a href="<?php bloginfo('url');?>/dat-lich">
                        Đặt lịch 
                      </a>
                  </li>
              <?php 
               if (($current_user->allcaps['level_7'] == true) ) 
                  {
              ?>
                  <li> <a href="<?php bloginfo('url');?>/quan-li-may">
                        Quản lí máy
                      </a>
                  </li>
              <?php }// end editor ?>
                  <?php 
                    global $current_user;
                    get_currentuserinfo();
                    if ($current_user->allcaps['level_10'] == true) 
                    {  // echo quyen cao nhat
                      ?>
                           <li> 
                             <a href="<?php bloginfo('url');?>/quan-li-nguoi-dung">
                                Quản lí người dùng
                              </a>
                          </li>
            </ul>           
                      <?php
                       
                    }// if ($current_user->allcaps['level_2'] == true) 
                    else {//echo 'cac quyen thap hon ';
                         }
                    
                    ?>
             <?php
              }//if ( is_user_logged_in() )
               else {
                  //echo 'Welcome, visitor!';
                     }
              ?>


        <?php
          }


        ?>
  </div><!-- id="nav_nano" Menu Area -->    


  

<?php 

//var_dump($current_user);
/*
$user = get_user_by( 'email', 'phuca4@gmail.com' );
//var_dump($user);
 echo 'User is :' . $user->ID . ' ' . $user->display_name;

global $current_user;
get_currentuserinfo();
echo $current_user->user_login;
echo '<br/>';
echo $current_user->roles[0];

var_dump($current_user);
echo $current_user->ID;
/*
echo 'phuc hoang';
//var_dump($current_user->allcaps);
if ($current_user->allcaps['level_10'] == true) {
   echo ' quyen cao nhat';
}else echo 'cac quyen thap hon ';


?>
